{{!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}{{!

Included in places where a Python object exists and its underlying C++
representation is required to be passed by value as a client call argument. For
most primitives, the conversion can be done automatically, but for strings and
structures, some work is required.

This template assumes that the Python object is in a variable named <field>.

}}{{#type:iobuf?}}deref((<__iobuf.IOBuf>{{field:py_name}}).c_clone()){{/type:iobuf?}}{{!
}}{{#type:iobufRef?}}((<__iobuf.IOBuf>{{field:py_name}}).c_clone()){{/type:iobufRef?}}{{!
}}{{#type:flexibleBinary?}}{{!
  }}{{> types/CythonCppType}}(move(<string>{{field:py_name}})){{!
}}{{/type:flexibleBinary?}}{{!
}}{{^type:hasCustomTypeBehavior?}}{{!
}}{{#type:bool?}}{{field:py_name}}{{/type:bool?}}{{!
}}{{#type:byte?}}{{field:py_name}}{{/type:byte?}}{{!
}}{{#type:i16?}}{{field:py_name}}{{/type:i16?}}{{!
}}{{#type:i32?}}{{field:py_name}}{{/type:i32?}}{{!
}}{{#type:i64?}}{{field:py_name}}{{/type:i64?}}{{!
}}{{#type:double?}}{{field:py_name}}{{/type:double?}}{{!
}}{{#type:float?}}{{field:py_name}}{{/type:float?}}{{!
}}{{#type:string?}}{{field:py_name}}.encode('UTF-8'){{/type:string?}}{{!
}}{{#type:binary?}}{{field:py_name}}{{/type:binary?}}{{!
}}{{#type:struct}}{{!
  }}deref((<{{> types/CythonPythonType}}>{{field:py_name}})._cpp_obj){{!
}}{{/type:struct}}{{!
}}{{#type:container?}}{{!
  }}deref((<{{> types/CythonPythonType}}>{{field:py_name}})._cpp_obj){{!
}}{{/type:container?}}{{!
}}{{#type:enum}}{{> types/CythonPythonType}}_to_cpp({{field:py_name}}){{/type:enum}}{{!
}}{{/type:hasCustomTypeBehavior?}}
